﻿/// <reference path="~/Scripts/jquery-vsdoc-cn.js"/>
$(function() {
    $("#ask_form").submit(function() {
        return bind_ask_form();
    });
    $("#txtAskName").keyup(function(){
        bind_ask_form_content1();
    });
    $("#txtAskContent").keyup(function(){
        bind_ask_form_content();
    });
});

function bind_ask_form() {
    var txtAskName = $("#txtAskName");
    var txtAskContent = $("#txtAskContent");
    if (txtAskName.val() == "") { alert('提问不能为空!'); return false; }
    if (txtAskContent.val() == "") { alert("问题说明不能为空!"); return false; }
    return true;
}

function bind_ask_form_content1() {
    var s = $("#txtAskName").val();
    var nowlength = s.length;
    if ((30 - nowlength) < 0) {
        s = s.substring(0, 30);
        $("#txtAskName").val(s)
        return;
    }
    $("#addTextWord1").html("已输入" + nowlength + "字，还可以输入" + (30 - nowlength) + "字");
}

function bind_ask_form_content() {
    var s = $("#txtAskContent").val();
    var nowlength = s.length;
    if ((600 - nowlength) < 0) {
        s = s.substring(0, 600);
        $("#txtAskContent").val(s)
        return;
    }
    $("#addTextWord").html("已输入" + nowlength + "字，还可以输入" + (600 - nowlength) + "字");
}